NGINX는 웹 서버이자 리버스 프록시, 로드 밸런서 등의 역할을 수행하는 고성능 서버 소프트웨어입니다.
sudo apt update
sudo apt install nginx -y
nginx-v
nginx -t
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl status nginx
NGINX 설정 파일(/etc/nginx/nginx.conf
)의 주요 구조는 다음과 같습니다.
user www-data;
worker_processed auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name example.com;
location / {
root /var/www/html;
index index.html index.htm;
}
}
}
worker_processes
: 처리할 수 있는 병력 작업 수 지정worker_connections
: 하나의 worker가 동시에 처리할 수 있는 최대 연결 수http {}
: 웹 서버 설정을 포함하는 블록server {}
: 개별 서버 설정을 정의하는 블록location {}
: 특정 URL 패턴에 대한 처리 방식 정의